home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / TC2PROM.ARJ / C0ROMX.ASM < prev    next >
Assembly Source File  |  1991-05-01  |  2KB  |  90 lines

  1.     NAME    c0romx
  2.     PAGE    60,96
  3.     TITLE    C0ROMX - Example ROM Startup Code
  4. ;[]------------------------------------------------------------[]
  5. ;|                                                              |
  6. ;|    C0ROMX.ASM -- Example ROM Startup Code            |
  7. ;|                                |
  8. ;|    Bob Haas    CompuServe 70357,3530            |
  9. ;|                                |
  10. ;[]------------------------------------------------------------[]
  11.  
  12. ;    Segment and Group declarations
  13.  
  14. _TEXT    SEGMENT BYTE PUBLIC 'CODE'
  15. _TEXT    ENDS
  16. _DATA    SEGMENT PARA PUBLIC 'DATA'
  17. _DATA    ENDS
  18. _BSS    SEGMENT WORD PUBLIC 'BSS'
  19. _BSS    ENDS
  20. _BSSEND SEGMENT BYTE PUBLIC 'BSSEND'
  21. _BSSEND ENDS
  22.  
  23. DGROUP    GROUP    _BSS, _BSSEND
  24. CGROUP  GROUP   _DATA,_TEXT
  25.  
  26. ; The following values will depend upon the amount and location of RAM
  27. ; This example assumes 32K of RAM starting at 0000:0
  28. ; The "startds" value puts the _BSS segment at 0:100 (allowing for
  29. ;  up to 256 bytes of interrupt vectors).
  30. ;  _BSS is 28K less 256 bytes
  31.  
  32. startds    equ    010h
  33.  
  34. ; These values set up the last 4K of the 32K RAM as a stack
  35.  
  36. startss    equ    0700h
  37. startsp    equ    0FFEh        ; sets up 4K stack
  38.  
  39.     ASSUME    CS:CGROUP, DS:DGROUP
  40.  
  41. _TEXT    SEGMENT
  42.     extrn    _main:near
  43.         public    STARTX
  44.  
  45. STARTX    PROC    NEAR
  46.     jmp    realstart
  47.     db    'Here is a good place to put a copyright statement'
  48.  
  49. realstart:
  50.         mov    ax,startds
  51.         mov    ds,ax
  52.  
  53.     mov    ax,startss
  54.     mov    ss,ax
  55.     mov    sp,startsp
  56.  
  57. ; Uncomment the following lines if you need to have
  58. ; uninitialized static variables set to 0 as in "ordinary" C
  59.  
  60. ;    xor    ax, ax
  61. ;    push    ds
  62. ;    pop    es
  63. ;    mov    di, offset DGROUP: bdata@
  64. ;    mov    cx, offset DGROUP: edata@
  65. ;    sub    cx, di
  66. ;    rep    stosb
  67.  
  68.     jmp    _main   ; will not return
  69.  
  70. STARTX          ENDP
  71.  
  72. _TEXT    ENDS
  73.  
  74. _BSS    SEGMENT
  75. bdata@    label    byte
  76. _BSS    ENDS
  77.  
  78. ; The _BSSEND segment is defined only so that we can get "edata@"
  79. ;  as the end of _BSS for the above initialization code
  80. ; No other module defines a _BSSEND segment, so "edata@" is
  81. ;  guaranteed to be the last byte of _BSS
  82.  
  83. _BSSEND SEGMENT
  84. edata@    label    byte
  85. _BSSEND ENDS
  86.     public    bdata@    ; make these show on the map
  87.     public    edata@    ; they don't need to be public otherwise
  88.     END
  89.  
  90.